<?php
class Number{
	static function priceFomart($price, $currency_id=false) {
        if ($price) {
            if ($currency_id) {
                if (isset(CGlobal::$currency[$currency_id])) {
                    $currency_id = " <font color='#B90404'>" . CGlobal::$currency[$currency_id] . "</font>";
                }
                else
                    $currency_id=" <font color='#B90404'>VNĐ</font>";
            }
            else {
                $currency_id = '';
            }
            if (preg_match('/\./', $price))
                return $price . $currency_id;
            else
                return number_format($price, 0, ',', '.') . $currency_id;
        }
        else {
            return "Liên hệ";
        }
    }
    
    static function price_fomart($price) {
        if ($price)
        {
            if (preg_match('/\./', $price))
                return $price;
            else
                return number_format($price, 0, ',', '.');
        }
        else
        {
            return 0;
        }
    }
}
?>